<!--创建新问题-->
<div class="template-grid" ng-cloak="">
    <div class="temp-preview subject">
        <h5>{{editIndex+1}}.&nbsp;&nbsp;{{question.title?question.title:'这是题目标题'}}</h5>
        <!--单选多选选项-->
        <div ng-if="questionTypes[question.type]=='单选'||questionTypes[question.type]=='多选'||questionTypes[question.type]=='评分题'" class="options">
            <div class="option mt10" ng-cloak="" ng-repeat="item in question.options track by $index">
                <!--单选-->
                <input type="radio" ng-if="questionTypes[question.type]=='单选'||questionTypes[question.type]=='评分题'"/>
                <!--多选-->
                <input type="checkbox" ng-if="questionTypes[question.type]=='多选'"/>
                <span ng-bind="item.text"></span>
                <img ng-if="item.resource" ng-src="{{item.resource}}" alt=""/>
                <input ng-if="item.fillable" type="text"/>
            </div>
        </div>
        <!--下拉框-->
        <!--<div ng-if="questionTypes[question.type]=='下拉框'" class="options">-->
        <!--<div class="ngDropdown" ng-cloak="" n="5" options="question.options" label="text" value="text" ng-model="selected"></div>-->
        <!--</div>-->
        <!--填空-->
        <div ng-if="questionTypes[question.type]=='填空'">
            <input class="line" type="text"/>
        </div>
    </div>
    <div class="templates">
        <form class="template t-radio" name="tRadio">
            <div class="temp-content">
                <div class="input-group">
                    <label>标题</label>
                    <input type="text" placeholder="请在此输入问题标题" ng-model="question.title"/>
                </div>
                <div class="checkbox-group">
                    <label>当前题型</label>
                    <span ng-bind="questionTypes[question.type]">单选题</span>
                    <div class="ngDropdown" ng-cloak="" n="3" options="questionTypes" ng-model="question.type"></div>
                    <div class="checkboxes">
                        <div class="checkbox-wrap">
                            <input type="checkbox" ng-model="question.required"/>{{question.required}}
                            <span ng-if="questionTypes[question.type]!='填空'">必选题</span>
                            <span ng-if="questionTypes[question.type]=='填空'">必填题</span>
                        </div>
                        <div class="checkbox-wrap" ng-if="editIndex">
                            <input type="checkbox" ng-model="question.linked" ng-click="openRelateModal($event,question)"/>
                            <span>逻辑关联</span>
                        </div>
                    </div>
                </div>
                <div class="table-wrap" ng-if="questionTypes[question.type]!='填空'">
                    <div class="table-grid">
                        <table>
                            <thead>
                            <tr>
                                <th>选项文字</th>
                                <th ng-if="questionTypes[question.type]=='单选'||questionTypes[question.type]=='多选'">图片</th>
                                <th ng-if="questionTypes[question.type]=='单选'||questionTypes[question.type]=='多选'">允许填空</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody class="tbody">
                            <tr ng-repeat="item in question.options track by $index" index="{{$index}}" ng-cloak="">
                                <td><input type="text" placeholder="请输入选项文字" ng-model="item.text"/></td>
                                <td ng-if="questionTypes[question.type]=='单选'||questionTypes[question.type]=='多选'">
                                    <i ng-if="!item.resource" ng-click="openImageModal($event,item)" class="fa fa-file-image-o fa-lg"></i>
                                    <img ng-if="item.resource" ng-click="openImageModal($event,item)" ng-cloak="" ng-src="{{item.resource}}" alt=""/>
                                </td>
                                <td ng-if="questionTypes[question.type]=='单选'||questionTypes[question.type]=='多选'">
                                    <span><input type="checkbox" ng-model="item.fillable">允许</span>
                                    <span ng-if="item.fillable"><input type="checkbox" ng-model="item.fill_required">必填</span>
                                </td>
                                <td>
                                    <a class="green" ng-click="addOption($event,$index)">添加</a>&nbsp;&nbsp;
                                    <a class="green" ng-click="deleteOption($event,item,$index)">删除</a>&nbsp;&nbsp;
                                    <!--<a class="green" ng-click="moveUpOption($event,item,$index)">上移</a>&nbsp;&nbsp;-->
                                    <!--<a class="green" ng-click="moveDownOption($event,item,$index)">下移</a>-->
                                </td>
                            </tr>
                            </tbody>
                        </table>
                    </div>
                    <div class="table-footer pt10">
                        <button class="small-green-button" ng-click="addOption($event,-1)"><i class="fa fa-plus"></i>添加选项</button>
                        <!--<div class="limit">-->
                        <!--最少<input type="number" class="number" value="0"/>选项&nbsp;&nbsp;-->
                        <!--最多<input type="number" class="number" value="0"/>选项-->
                        <!--</div>-->
                    </div>
                </div>
                <!--填空-->
                <!--<div class="checkbox-group" ng-if="questionTypes[question.type]=='填空'">-->
                <!--<label>限制条件</label>-->
                <!--<div class="limit">-->
                <!--最小字数<input type="number" class="number" value="0"/>&nbsp;&nbsp;-->
                <!--最大字数<input type="number" class="number" value="0"/>-->
                <!--</div>-->
                <!--</div>-->
            </div>
            <div class="temp-footer">
                <button class="green-solid-button" ng-click="submitEdit($event)">完成编辑</button>
                <button class="green-solid-button" ng-click="cancelEdit($event)">取消编辑</button>
            </div>
        </form>
    </div>
</div>